// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2015-2016 Andrey Antukh <niwi@niwi.nz>
// Copyright (c) 2015-2016 Juan de la Cruz <delacruzgarciajuan@gmail.com>

#workspace {
  user-select: none;
}

.workspace-context-menu {
  background-color: $color-white;
  border-radius: $br-small;
  box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.25);
  left: 740px;
  position: absolute;
  top: 40px;
  width: 240px;
  z-index: 12;
  padding: $x-small 0;

  li {
    align-items: center;
    font-size: $fs14;
    padding: $x-small $medium;
    cursor: pointer;

    display: flex;
    justify-content: space-between;

    &.separator {
      border-top: 1px solid $color-gray-10;
      padding: 0px;
      margin: 2px;
    }

    span:first-child {
      color: $color-gray-60;
    }

    span:last-child {
      color: $color-gray-20;
    }

    &:hover {
      background-color: $color-primary-lighter;
    }
  }
}

.workspace-loader {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;

  svg#loader-pencil {
    fill: $color-gray-50;
  }
}

.workspace-content {
  background-color: $color-canvas;
  display: flex;
  height: 100%;
  width: calc(100% - #{$width-left-toolbar} - 2 * #{$width-settings-bar});
  padding: 0;
  margin: 0;
  position: fixed;
  right: $width-settings-bar;

  &.scrolling {
    cursor: grab;
  }

  &.no-tool-bar-right {
    width: calc(100% - #{$width-left-toolbar} - #{$width-settings-bar});
    right: 0;

    .coordinates {
      right: 10px;
    }
  }

  &.no-tool-bar-left {
    width: calc(100% - #{$width-left-toolbar} - #{$width-settings-bar});

    &.no-tool-bar-right {
      width: 100%;
    }
  }

  .coordinates {
    background-color: $color-dark-bg;
    border-radius: $br-small;
    bottom: -10px;
    padding-left: 5px;
    position: fixed;
    right: calc(#{$width-settings-bar} + 10px);
    text-align: center;
    width: 100px;
    padding-bottom: 2px;

    span {
      color: $color-white;
      font-size: $fs12;
      padding-right: 5px;
    }
  }

  .cursor-tooltip {
    background-color: $color-dark-bg;
    border-radius: $br-small;
    color: $color-white;
    font-size: $fs12;
    padding: 3px 8px;
    transition: none;
    text-align: center;
  }

  .workspace-viewport {
    height: calc(100% - 40px);
    overflow: hidden;
    transition: none;
    width: 100%;

    display: grid;
    grid-template-rows: 20px 1fr;
    grid-template-columns: 20px 1fr;

    .viewport {
      grid-column: 1 / span 2;
      grid-row: 1 / span 2;
      overflow: hidden;

      &.drawing {
        cursor: cell;
      }

      rect.selection-rect {
        fill: rgba(235, 215, 92, 0.1);
        stroke: #000000;
        stroke-width: 0.1px;
      }

      g.controls {
        rect.main { pointer-events: none; }
      }
    }

    .page-canvas, .page-layout {
      overflow: visible;
    }
  }

  /* Rules */

  .empty-rule-square {
    grid-column: 1 / span 1;
    grid-row: 1 / span 1;
  }

  .horizontal-rule {
    transition: none;
    pointer-events: none;
    grid-column: 2 / span 1;
    grid-row: 1 / span 1;
    z-index: 13;

    rect {
      fill: $color-canvas;
    }
    path {
      stroke: $color-gray-20;
    }
  }

  .vertical-rule {
    transition: none;
    pointer-events: none;
    grid-column: 1 / span 1;
    grid-row: 2 / span 1;
    z-index: 13;

    rect {
      fill: $color-canvas;
    }
    path {
      stroke: $color-gray-20;
    }
  }

}

.workspace-frame-label {
  fill: $color-gray-40;
  font-size: $fs12;
}

.selected .workspace-frame-label {
  fill: $color-primary-dark;
}

.multiuser-cursor {
  align-items: center;
  display: flex;
  left: 0;
  position: absolute;
  top: 0;
  z-index: 10000;

  svg {
    height: 15px;
    fill: #f3dd14;
    width: 15px;
  }

  span {
    background-color: #f3dd14;
    border-radius: $br-small;
    color: $color-black;
    font-size: $fs12;
    margin-left: $small;
    padding: $x-small;
  }
}
